import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:程序逻辑控制
 * User: liangyuanzhang
 * Date: 2024-11-27
 * Time: 0:13
 */


public class Test {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("读入一个字符串：");
        String str = scan.nextLine();
        //String str = scan.next();

        /*
        next()遇到空格会结束，
        nextLine()读一行，建议使用
         */
        System.out.println(str);
        System.out.println("读入一个整形");
        int age = scan.nextInt();
        System.out.println(age);

        System.out.println("读入一个小数");
        float f = scan.nextFloat();
        System.out.println(f);
    }
    public static void main15(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = scanner.nextLine();
        System.out.println(name);
    }
    public static void main14(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(n);
        float f =scanner.nextFloat();
        System.out.println(f);

    }
    public static void main13(String[] args) {
        int a = 0;
        do {
            System.out.println(a);
        }while(a != 0);
    }
    public static void main12(String[] args) {
        int sum = 0;
        int ret = 1;
        for (int j = 1; j <= 5; j++) {
            for (int i = 1; i <= j ; i++) {
                ret *= i;
            }
            sum += ret;
        }
        System.out.println(sum);
    }
    public static void main11(String[] args) {
        for (int i = 1;i <= 10;i++){
            System.out.println(i);
        }

        for (int i = 0; i < 10; i++) {
            System.out.println(i);
        }

        for (int i = 0; i < 10; i++) {
            System.out.println(i);
        }

        int a = 10;
        System.out.println(a);
    }
    public static void main10(String[] args) {
        //求出 1-100之间 所有既能被3 也能被5 整除的数字 要使用break 或者continue 做
        int i = 1;
        while(i <= 100){
            if(i % 15 != 0){
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }
    public static void main9(String[] args) {
        int i = 1;
        while(i <= 7){
            if(i == 3 ){
                i++;
                continue;
                //System.out.println("haha");
            }
            System.out.println(i);
            i++;
        }
    }
    public static void main8(String[] args) {
        int j = 1;
        int sum = 0;
        while(j <= 5){
            int i = 1;
            int ret = 1;
            while(i <= j){
                ret *= i;
                i++;
            }
            j++;
            sum += ret;
        }
        System.out.println(sum);
    }
    public static void main7(String[] args) {
        //求某个数字的阶乘
        int i = 1;
        int ret = 1;
        while (i <= 5) {
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }
    public static void main6(String[] args) {
        int i = 1;
        while(i <= 10){
            System.out.print(i+" ");
            i++;
        }
    }
    public static void main5(String[] args) {
        int a = 10;
        /*
        float、double、long、boolean
        以上4钟数据类型都不能作为 switch() 的参数
        switch() 不能是一个复杂的表达式
         */
        switch (a){
            case 1:
                System.out.println(1);
                break;
            case 2:
                System.out.println(2);
                break;
            case 3:
                System.out.println(3);
                break;
            default:
                System.out.println("haha");
                break;
        }
    }
    public static void main4(String[] args) {
        int year = 2000;
        if (year % 100 == 0) {
// 判定世纪闰年
            if (year % 400 == 0) {
                System.out.println("是闰年");
            } else {
                System.out.println("不是闰年");
            }
        } else {
// 普通闰年
            if (year % 4 == 0) {
                System.out.println("是闰年");
            } else {
                System.out.println("不是闰年");
            }
        }
    }
    public static void main3(String[] args) {
        int num = 10;
        if(num % 2==0){
            System.out.println("偶数");
        }else{
            System.out.println("奇数");
        }
    }
    public static void main2(String[] args) {
        boolean flg = true;
        if(flg){
            System.out.println("aaa");
        }else{
            System.out.println("nnn");
        }
    }
    public static void main1(String[] args) {
        System.out.println("aaa");
        System.out.println("bbb");
        System.out.println("ccc");
    }
}
